package com.roc.web.action.unPay;

import java.util.ArrayList;
import java.util.List;

import com.roc.page.BaseSearchCondition;
import com.roc.page.WhereHQLFieldBean;
import com.roc.util.Constance;

public class UnPaySearchCondition extends BaseSearchCondition {

	private static final long serialVersionUID = 1L;
	
	private String merchantNo;//商户号
	private String terminalNo;//终端号
	private String accountNo;//结算帐号
	private String accountName;//结算账户名称
	private String ylId;//直连所属银行ID
	private String addTime;//添加时间

	@Override
	protected List<WhereHQLFieldBean> getWhereHQLFieldBeanList() {
		List<WhereHQLFieldBean> filedBeanList = new ArrayList<WhereHQLFieldBean>();
		if(Constance.isNotEmpty(merchantNo)){
			filedBeanList.add(new WhereHQLFieldBean("t.merchant_No", merchantNo,"=", false));
		}
		if(Constance.isNotEmpty(terminalNo)){
			filedBeanList.add(new WhereHQLFieldBean("t.terminal_No", terminalNo,"=", false));
		}
		if(Constance.isNotEmpty(accountNo)){
			filedBeanList.add(new WhereHQLFieldBean("t.account_No", accountNo,"=", false));
		}
		if(Constance.isNotEmpty(accountName)){
			filedBeanList.add(new WhereHQLFieldBean("t.account_Name", accountName,"=", false));
		}
		if(Constance.isNotEmpty(ylId)){
			filedBeanList.add(new WhereHQLFieldBean("t.yl_Id", ylId,"=", false));
		}
		if(Constance.isNotEmpty(addTime)){	
			filedBeanList.add(new WhereHQLFieldBean("to_char(t.add_Time,'yyyy-MM-dd')",addTime, "=", false));
		}
		return filedBeanList;
	}

	@Override
	protected String getRowCountHQL() {
		StringBuffer sb=new StringBuffer();
		sb.append(" select count(1) from t_unpay_merinfo t where 1=1 ");
		return sb.toString();
	}

	@Override
	protected String getSearchHQL() {
		StringBuffer sb=new StringBuffer();
		sb.append(" select t.id,t.merchant_no,t.terminal_no,t.fee_t1,t.fee_t1_top,t.fee_t0,t.account_no,t.account_name,t.bank_name,t.bank_code,t.yl_id,to_char(t.add_time,'yyyy-MM-dd'),t.oper,t.remark from t_unpay_merinfo t where 1=1 ");
		return sb.toString();
	}

	@Override
	protected String getOrderPartOfHQL() {
		
		return "  order by t.add_time desc ";
	}

	public String getMerchantNo() {
		return merchantNo;
	}

	public void setMerchantNo(String merchantNo) {
		this.merchantNo = merchantNo;
	}

	public String getTerminalNo() {
		return terminalNo;
	}

	public void setTerminalNo(String terminalNo) {
		this.terminalNo = terminalNo;
	}

	public String getAccountNo() {
		return accountNo;
	}

	public void setAccountNo(String accountNo) {
		this.accountNo = accountNo;
	}

	public String getAccountName() {
		return accountName;
	}

	public void setAccountName(String accountName) {
		this.accountName = accountName;
	}

	public String getYlId() {
		return ylId;
	}

	public void setYlId(String ylId) {
		this.ylId = ylId;
	}

	public String getAddTime() {
		return addTime;
	}

	public void setAddTime(String addTime) {
		this.addTime = addTime;
	}

}
